<template>
  <base-breadcrumb>
    <searchData
      :search-data="searchArr"
      @search="search"
    />

    <a-card :bordered="false">
      <!-- <title-name title="项目停工申请列表" /> -->

      <div class="table-operator">
        <a-button
          v-btnPermission="'pm_024_add_01'"
          type="primary"
          @click="handelAdd"
        >
          新增停工申请
        </a-button>
      </div>

      <div class="pub-table-select-count">
        <a-icon
          type="info-circle"
          theme="twoTone"
        />
        <span style="margin-right: 12px"> 总申请数：<span class="totalNum">{{ totalDels.total	}} 个</span> |
          停工-审核中：<span class="totalNum">{{ totalDels.reviewNum }} 个</span> |
          停工-审核不通过 ：<span class="totalNum">{{ totalDels.unreviewNum	}} 个</span> |
          停工：<span class="totalNum">{{ totalDels.stopNum }} 个</span> |
          重新开工-审核中 ：<span class="totalNum">{{ totalDels.returnNum }} 个</span> |
          在建 ：<span class="totalNum">{{ totalDels.startNum }} 个</span>
        </span>
      </div>

      <list-table
        ref="table"
        size="default"
        :row-key="record => record.id"
        :columns="columns"
        :request="loadData"
        :alert="true"
        show-size-changer
        show-quick-jumper
        show-pagination="auto"
      >
        <span
          slot="serial"
          slot-scope="text, record, index"
        >{{ index + 1 }}</span>
        <span
          slot="status"
          slot-scope="text"
        >
          <a-badge
            :status="text | statusTypeFilter"
            :text="text | statusFilter"
          />
        </span>
        <span
          slot="description"
          slot-scope="text"
        >
          <ellipsis
            :length="8"
            tooltip
          >{{ text }}</ellipsis>
        </span>
        <span
          slot="action"
          slot-scope="text, record"
        >
          <template>
            <MoreButton>
              <a
                v-btnPermission="'pm_024_loo_02'"
                @click="handleDels(record)"
              >查看</a>

              <span
                v-if="record.statusCode == '2' "
                v-btnPermission="'pm_024_edi_03'"
              >
                <a @click="handleEdit(record)">编辑</a>
              </span>
              <span v-btnPermission="'pm_024_moi_05'"><a @click="handleApproveDetail(record)">审批信息</a>
              </span>

              <span
                v-if="record.statusCode == '1' "
                v-btnPermission="'pm_024_aga_04'"
              >
                <a @click="handleApply(record)">重新开工申请</a>
              </span>
            </MoreButton>
          </template>
        </span>
      </list-table>

      <!--<a-modal width="900px" :visible="visible" :title="title" >-->
      <a-modal
        v-if="visible"
        width="900px"
        :visible="true"
        :title="title"
        @cancel="visible=false"
      >
        <title-name title="停工信息" />
        <template slot="footer">
          <a-button
            key="back"
            @click="handleCancel"
          >
            取消
          </a-button>
          <a-button
            key="submit"
            :loading="loading"
            type="primary"
            @click="handleOk"
          >
            提交审批
          </a-button>
        </template>
        <a-form-model
          ref="form1"
          :model="form"
          :rules="rules1"
        >
          <a-row>
            <a-col :span="24">
              <a-form-model-item
                label="所属单位"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="projectId"
              >
                <org-tree-select
                  v-model="form.projectId"
                  is-auto-select-first
                  is-need-auth
                  check-strictly
                  is-special-tree
                  :is-query-projec-detail="false"
                  :status-set="[1, 2, 3]"
                  :exclude-business-set="!!this.businessId1 ? [ this.businessId1]: []"
                  :extra-query="{
                    ifProjectStopWork: 1,
                    auditStatus: 2
                  }"
                  :disabled="statusCodes == '2'"
                  @select="selectOrg"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <!--          <a-row>-->
          <!--            <a-col-->
          <!--              :md="12"-->
          <!--              :sm="12"-->
          <!--            >-->
          <!--              <a-form-model-item-->
          <!--                label="分公司"-->
          <!--                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"-->
          <!--                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"-->
          <!--                prop="branchId"-->
          <!--              >-->
          <!--                <SelectSubCompany-->
          <!--                  v-model="form.branchId"-->
          <!--                  :disabled="statusCodes == '2'"-->
          <!--                  placeholder="请选择"-->
          <!--                  @change="getBranchId"-->
          <!--                />-->
          <!--              </a-form-model-item>-->
          <!--            </a-col>-->
          <!--            <a-col-->
          <!--              :md="12"-->
          <!--              :sm="12"-->
          <!--            >-->
          <!--              <a-form-model-item-->
          <!--                label="项目名称"-->
          <!--                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"-->
          <!--                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"-->
          <!--                prop="projectId"-->
          <!--              >-->
          <!--                <SelectProject-->
          <!--                  v-model="form.projectId"-->
          <!--                  :disabled="statusCodes == '2'"-->
          <!--                  :if-project-stop-work="true"-->
          <!--                  placeholder="请选择"-->
          <!--                  :is-clear="true"-->
          <!--                  :form="form"-->
          <!--                  key-value="branchId"-->
          <!--                  @change="getProjectId"-->
          <!--                  @projectNum="projectNumOne"-->
          <!--                />-->
          <!--              </a-form-model-item>-->
          <!--            </a-col>-->
          <!--          </a-row>-->
          <a-row>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="项目编号"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="form.projectNum"
                  disabled
                />
              </a-form-model-item>
            </a-col>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="停工原因"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="reasonCode"
              >
                <a-select
                  v-model="form.reasonCode"
                  placeholder="请选择"
                >
                  <a-select-option
                    v-for="item in reasons"
                    :key="item.id"
                    :value="item.id"
                  >
                    {{ item.name }}
                  </a-select-option>
                </a-select>
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="停工时间"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="downTime"
              >
                <a-date-picker
                  v-model="form.downTime"
                  style="width: 100%"
                  @change="onChangeDown"
                />
              </a-form-model-item>
            </a-col>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="预计重新开工时间"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="returnTime"
              >
                <a-date-picker
                  v-model="form.returnTime"
                  style="width: 100%"
                  @change="onChangeReturn"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col
              :md="24"
              :sm="24"
            >
              <a-form-model-item
                label="情况说明"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="descriptions"
              >
                <BaseTextarea
                  v-model="form.descriptions"
                  placeholder="请输入情况说明"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="创建人"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="form.creater"
                  disabled
                />
              </a-form-model-item>
            </a-col>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="创建时间"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="form.createTime"
                  disabled
                />
              </a-form-model-item>
            </a-col>
          </a-row>

          <title-name title="上传相关附件" />
          <!--<u-table :isShow="true" :businessCode="businessCode" @fileArrysData="fileArrysData"></u-table>-->
          <u-table
            :list-url="listUrl"
            :upload-arrys="uploadArrys"
            :req-method="reqMethod"
            :upload-list="uploadList"
            :business-id="businessId"
            :delete-url="deleteUrl"
            :if-stop-work="true"
            business-code="PM13"
            @fileArrysData="fileArrysData"
          />
        </a-form-model>
      </a-modal>

      <a-modal
        v-if="visibles"
        width="900px"
        :visible="true"
        :title="titles"
        @cancel="visibles=false"
      >
        <title-name title="重新开工信息" />
        <template slot="footer">
          <a-button
            key="back"
            @click="handleCancels"
          >
            取消
          </a-button>
          <a-button
            key="submit"
            :loading="loading"
            type="primary"
            @click="handleOks"
          >
            提交审批
          </a-button>
        </template>
        <a-form-model
          ref="form2"
          :model="forms"
          :rules="rules2"
        >
          <a-row>
            <a-col
              :md="24"
              :sm="24"
            >
              <a-form-model-item
                label="所属单位"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="forms.viewName"
                  type="text"
                  disabled
                />
              </a-form-model-item>
            </a-col>
<!--            <a-col-->
<!--              :md="12"-->
<!--              :sm="12"-->
<!--            >-->
<!--              <a-form-model-item-->
<!--                label="分公司"-->
<!--                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"-->
<!--                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"-->
<!--              >-->
<!--                <BaseInput-->
<!--                  v-model="forms.branch"-->
<!--                  type="text"-->
<!--                  disabled-->
<!--                />-->
<!--              </a-form-model-item>-->
<!--            </a-col>-->
<!--            <a-col-->
<!--              :md="12"-->
<!--              :sm="12"-->
<!--            >-->
<!--              <a-form-model-item-->
<!--                label="项目名称"-->
<!--                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"-->
<!--                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"-->
<!--              >-->
<!--                <BaseInput-->
<!--                  v-model="forms.projectName"-->
<!--                  type="text"-->
<!--                  disabled-->
<!--                />-->
<!--              </a-form-model-item>-->
<!--            </a-col>-->
          </a-row>
          <a-row>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="项目编号"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="forms.projectNum"
                  type="text"
                  disabled
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col
              :md="24"
              :sm="24"
            >
              <a-form-model-item
                label="情况说明"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
                prop="descriptions"
              >
                <BaseTextarea
                  v-model="forms.descriptions"
                  placeholder="请输入情况说明"
                />
              </a-form-model-item>
            </a-col>
          </a-row>
          <a-row>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="申请人"
                :label-col="{ lg: { span: 5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="forms.creater"
                  disabled
                />
              </a-form-model-item>
            </a-col>
            <a-col
              :md="12"
              :sm="12"
            >
              <a-form-model-item
                label="申请时间"
                :label-col="{ lg: { span:5 }, sm: { span: 5 } }"
                :wrapper-col="{ lg: { span: 18 }, sm: { span: 18 } }"
              >
                <BaseInput
                  v-model="forms.createTime"
                  disabled
                />
              </a-form-model-item>
            </a-col>
          </a-row>

          <title-name title="上传相关附件" />
          <u-table
            :list-url="listUrls"
            :req-method="reqMethod"
            :upload-list="uploadList"
            :business-id="businessId"
            :if-stop-construction="true"
            :delete-url="deleteUrl"
            business-code="PM22"
            @fileArrysData="fileArrysDatas"
          />
        </a-form-model>
      </a-modal>

      <ApprovalDetails
        :title="'审批详情'"
        :business-id="businessId1"
        :visible="visibleApprove"
        @cancel="visibleApprove = false"
        @confirm="visibleApprove = false"
      />
      <!-- 选择审批人 -->
      <selectApprover
        :business-id="businessId1"
        :process-config="setProcessConfig"
        :is-close-upper="false"
        @close="closeSelectApprover"
      />
      <!-- 选择审批人 -->
    </a-card>
  </base-breadcrumb>
</template>

<script>
import { STable, Ellipsis } from '@/components'
import { getstopWorkList, getstopWorkTotal, addstopWork, editstopWork, workApplication, getProjectCommon, getProjectStopWorkDetails } from '@/api/project/stopWork'
import SelectSubCompany from '@/components/Select/SelectSubCompany' // 分公司
import SelectProject from '@/components/SelectProjects/SelectProject' // 项目
import OrgTreeSelect from '@/components/OrgTreeSelect'
import ApprovalDetails from '@/components/approvalDetails'

import ARow from 'ant-design-vue/es/grid/Row'

const columns = [
  {
    title: '序号',
    width: 65,

    scopedSlots: { customRender: 'serial' }
  },
  {
    title: '项目名称',
    width: 100,
    dataIndex: 'projectName'
  },
  {
    title: '项目编号',
    width: 100,
    dataIndex: 'projectNum'
  },
  {
    title: '分公司',
    width: 90,
    dataIndex: 'branch'
  },
  {
    title: '停工原因',
    width: 100,
    dataIndex: 'reasonName'
  },
  {
    title: '停工时间',
    width: 100,
    dataIndex: 'downTime'
  },
  {
    title: '预计重新开工时间',
    width: 120,
    dataIndex: 'returnTime'
  },
  {
    title: '创建人',
    width: 90,
    dataIndex: 'createName'
  },
  {
    title: '创建时间',
    width: 100,
    dataIndex: 'createTime'
  },
  {
    title: '状态',
    width: 60,
    dataIndex: 'statusName'
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 220,
    fixed: 'right',
    scopedSlots: { customRender: 'action' }
  }
]

export default {
  name: 'a' + Date.now(),
  components: {
    SelectSubCompany,
    SelectProject,
    ARow,
    STable,
    Ellipsis,
    ApprovalDetails
  },
  data() {
    return {
      visibleApprove: false,

      uploadArrys: [],

      loading: false,

      columns,
      reqMethod: 'post',

      searchArr: [
        // 搜索框
        // {
        //   name: '项目名称',
        //   value: 'projectName',
        //   type: 'input'
        // },
        {
          name: '所属单位',
          valueKey: 'searchQuery',
          type: OrgTreeSelect,
        },
        {
          name: '状态',
          value: 'statusCode',
          type: 'select',
          data: [
            {
              value: 'A,1',
              label: '停工-审核中'
            },
            {
              value: 'A,2',
              label: '停工'
            },
            {
              value: 'A,3',
              label: '停工-审核不通过'
            },
            {
              value: 'B,1',
              label: '重新开工-审核中'
            },
            {
              value: 'B,2',
              label: '在建'
            }
          ]
        },
        {
          name: '停工原因',
          value: 'reasonCode',
          type: 'select',
          data: []
        }
      ],

      // 停工附件上传
      listUrl: '',
      deleteUrl: '/cscec-project-business/project/shutdown/management/fileDelete',
      uploadList: '/cscec-project-business/project/shutdown/management/fileUpload',
      businessId: '',

      // 重新开工附件上传
      listUrls: '',

      visible: false,
      title: '',

      isShow: true,

      visibles: false,
      titles: '重新开工申请',

      form: {
        creater: JSON.parse(sessionStorage.getItem('ycloud-user_info')).name,
        createTime: this.getNowTime()
      }, // 新增停工
      forms: {
        creater: JSON.parse(sessionStorage.getItem('ycloud-user_info')).name,
        createTime: this.getNowTime(),
        descriptions: '',
        viewName: ''
      }, // 重新开工申请
      queryParam: {},

      data: [],
      // 加载数据方法 必须为 Promise 对象
      loadData: (parameter) => {
        const requestParameters = Object.assign({}, parameter, this.queryParam)
        return getstopWorkList(requestParameters).then((res) => {
          return res
        })
      },
      selectedRowKeys: [],
      selectedRows: [],
      reasons: [],
      totalDels: {},
      //
      rules1: {
        branchId: [{ required: true, message: '请选择分公司', trigger: 'change' }],
        projectId: [{ required: true, message: '请选择项目', trigger: 'change' }],
        reasonCode: [{ required: true, message: '请选择停工原因', trigger: 'change' }],
        downTime: [{ required: true, message: '请选择停工时间', trigger: 'change' }],
        returnTime: [{ required: true, message: '请选择预计重新开工时间', trigger: 'change' }],
        descriptions: [{ required: true, message: '请输入情况说明', trigger: 'blur' }]
      },
      rules2: {
        descriptions: [{ required: true, message: '请输入情况说明', trigger: 'blur' }]
      },

      statusCodes: '',
      // 流程配置
      processConfig: null,
      processConfig1: null,
      //点击提交发送流程配置值
      setProcessConfig: null,
      // 业务id
      businessId1: null
    }
  },

  async created() {
    this.getstopWorkTotal()
    this.getProjectCommon()
    //获取通过获取流程配置值
    // 停工
    this.processConfig = await this.$getConfigFn('project_shutdown')
    // 开工
    this.processConfig1 = await this.$getConfigFn('application_reopen')

  },
  computed: {
    // rowSelection() {
    //   return {
    //     selectedRowKeys: this.selectedRowKeys,
    //     selectedRows: this.selectedRows,   // 当前行所有数据
    //     onChange: this.onSelectChange
    //   }
    // }
  },
  methods: {
    selectOrg(val) {
      if(val.length > 1) {
        this.form.branchId = val[val.length - 2].orgId
        this.$set(this.form, 'projectNum', val[val.length - 1].projectCode)
      }
    },
    handleApproveDetail(record) {
      this.visibleApprove = true
      this.businessId1 = record.id
    },
    getBranchId(val) {
      this.form.branchId = val
    },
    getProjectId(val) {
      this.form.projectId = val
    },
    projectNumOne(val) {
      this.form.projectNum = val
    },
    getProjectCommon() {
      getProjectCommon({ type: 17 }).then((res) => {
        this.reasons = res.data
        this.searchArr[2].data = this.getChangeDatatTypes(res.data)
      })
    },
    fileArrysData(val) {
      this.form.fileInfoList = val
    },
    fileArrysDatas(val) {
      this.forms.fileIdList = val
    },
    handleApply(record) {
      this.visibles = true
      this.forms = record
      this.forms.viewName = this.forms.branch + '/' + this.forms.projectName
      this.forms.descriptions = ''
      this.forms.creater = JSON.parse(sessionStorage.getItem('ycloud-user_info')).name
      this.forms.createTime = this.getNowDate()
      // this.businessId = record.id
      // this.listUrls= '/cscec-project-business/project/shutdown/management/resume-fileQuery'
      // this.uploadList= '/cscec-project-business/project/shutdown/management/fileUpload'
    },

    search(val) {
      this.queryParam = val
      this.$refs.table.refresh(true)
      this.getstopWorkTotal()
    },

    handelAdd() {
      this.visible = true
      this.title = '新增停工申请'
      this.form = {}
      this.businessId1 = ''
      this.form.creater = JSON.parse(sessionStorage.getItem('ycloud-user_info')).name
      this.form.createTime = this.getNowDate()
      this.statusCodes = ''
      this.uploadArrys = []
    },

    getstopWorkTotal() {
      getstopWorkTotal(this.queryParam).then((res) => {
        this.totalDels = res.data
      })
    },

    onChangeDown(val) {
      this.form.downTime = val.format('YYYY-MM-DD')
      if (this.form.returnTime != '' || this.form.returnTime != undefined) {
        var startTime = new Date(this.form.downTime)
        var endTime = new Date(this.form.returnTime)
        if (startTime > endTime) {
          this.$message.error('停工日期不能大于预测开工时间！')
          this.form.downTime = undefined
          return
        }
      }
    },

    onChangeReturn(val) {
      this.form.returnTime = val.format('YYYY-MM-DD')
      if (this.form.downTime != '' && this.form.downTime != undefined) {
        var startTime = new Date(this.form.downTime)
        var endTime = new Date(this.form.returnTime)

        if (endTime < startTime) {
          this.$message.error('预测开工时间不能小于停工日期！')
          this.form.returnTime = undefined
          return
        }
      }
    },

    handleDels(val) {
      //  项目停工详情
      this.$router.push({ path: '/project/stop-work/details', query: { id: val.id, statusCode: val.statusCode } })
    },

    handleEdit(e) {
      this.title = '编辑项目停工申请'
      this.businessId1 = e.id
      getProjectStopWorkDetails({ id: e.id }).then((res) => {
        if (res.code == 200) {
          this.visible = true
          this.$nextTick(() => {
            this.form.projectId = res.data.projectId
          })
          this.form = { ...res.data }
          if (res.data.fileInfoList != null) {
            this.uploadArrys = res.data.fileInfoList
          }
          this.statusCodes = res.data.statusCode
          this.form.creater = res.data.creatorName
        }
      })
    },

    handleCancel() {
      this.visible = false
    },
    handleCancels() {
      this.visibles = false
    },
    handleOks() {
      if (this.loading) return
      this.$refs.form2.validate((err, value) => {
        if (err) {
          this.loading = true
          this.setProcessConfig = null
          this.submitApprovalConfirm(this.processConfig1, (flag)=>{
            if(!flag) {
              this.loading = false
              return
            }
            workApplication(this.forms)
                    .then((res) => {
                      this.loading = false
                      if (res.code == 200) {
                       this.visibles = false;
                        this.$message.success('重新开工申请成功！')
                        this.businessId1 = res.data
                        this.setProcessConfig = this.processConfig1
                        if(this.processConfig1*1 === 4){
                          this.closeSelectApprover();
                        }
                      }
                    })
                    .finally(() => {
                      this.loading = false
                    })
          })
        }
      })
    },
    handleOk() {
      if (this.loading) return

      if (this.form.fileInfoList != null) {
        let ids = []
        this.form.fileInfoList.forEach(function (obj, i) {
          ids.push(obj.commonId)
        })
        this.form.fileIdsList = ids
      }

      if (this.form.id) {
        this.$refs.form1.validate((err, value) => {
          if (err) {
            this.loading = true
            this.setProcessConfig = null
            this.submitApprovalConfirm(this.processConfig,(flag)=>{
              if(!flag) {
                this.loading = false
                return
              }
              editstopWork(this.form)
                      .then((res) => {
                        this.loading = false
                        if (res.code == 200 || res.data.code == 200) {
                          this.visible = false
                          this.$message.success('提交成功！')
                          this.setProcessConfig = this.processConfig
                          if( this.processConfig1*1 === 4){
                            this.closeSelectApprover();
                          }
                        }
                      })
                      .finally(() => {
                        this.loading = false
                      })
            })
          }
        })
      } else {
        this.$refs.form1.validate((err, value) => {
          if (err) {
            this.loading = true
            this.setProcessConfig = null
            this.submitApprovalConfirm(this.processConfig, (flag)=>{
              if(!flag) {
                this.loading = false
                return
              }
              addstopWork(this.form)
                      .then((res) => {
                        console.log(res)
                        this.loading = false
                        if (res.code == 200 || res.data.code == 200) {
                          this.visible = false
                          this.$message.success('提交成功！')
                          this.businessId1 = res.data
                          this.setProcessConfig = this.processConfig
                        }
                      })
                      .finally(() => {
                        this.loading = false
                      })
            })
          }
        })
      }
    },
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    },
    /**
     * @description: 选择审批人关闭回调时关闭提交弹窗
     * @return {void}
     */
    closeSelectApprover() {
      this.handleCancel()
      this.handleCancels()
      this.$refs.table.refresh(true)
    }
  }
}
</script>


